<template>
  <div class="text-left padding-lr">
    <el-card>
      <div slot="header" class="clearfix relative">
        <span class="title-icon">修改装车计划号</span>
        <!--查询按钮 点击查询 -->
      </div>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="装车计划号">
          <el-input v-model="form.waybillNo"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="updateWaybillZcNo">修改</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
  //引入 ajax 工具
  import {ajax} from "@/store/yg/common/utils";
  //翻译工具
  import {m} from "@/store/yg/common/local";
  import * as constant from '@/store/yg/common/constant';
  import axios from "axios";
  import {untransform} from '@/store/yg/common/uri'
  import {closeDialog} from '@/utils';

  export default {
    props: ['row', 'data'],
    data() {
      return {
        form: {
          id: '',
          waybillNo: ''
        }
      };
    },
    //生命周期函数  页面渲染完成
    mounted() {
      const dataObjetc = this.$store.state.edit.row;
      console.log('dataObjetc', dataObjetc)
      this.form.id = dataObjetc.id;
      this.form.waybillNo = dataObjetc.waybillNo;
    },
    //方法
    methods: {
      async updateWaybillZcNo() {
        console.log('submit!', this.form);
        const {code, data, message} = await ajax("updateWaybillZcNo", this.form);
        if (code !== 200) {
          //框架错误提示信息
          if (message) {
            this.$message.error(message);
          } else {
            this.$message.error("服务器异常");
          }
        } else {
          this.$message.success("修改成功");
          closeDialog();
          location.reload();
        }
      },
      cancel() {
        closeDialog();
      }
    }
  };
</script>

<style scoped>
  /deep/ .el-select,
  .el-input-number,
  .el-date-editor {
    width: 100%;
  }
</style>
